From: Florian Müllner Date: Sun, 12 Jun 2022 16:27:34 +0000 (+0200) Subject: notificationDaemon: Stop auto-dismissing on focus changes X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~461^2^2~253 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=12a203a1db59dfc7a51a482e5bb2619aa0915db2;p=gnome-shell.git notificationDaemon: Stop auto-dismissing on focus changes This behavior dates back all the way to the original gnome-shell release, and it did make sense at the time: - we were first to make notifications persistent instead of closing them after a timeout; apps were therefore used to treat notifications as fire-and-forget instead of closing them when no longer relevant - neither web notifications not portals did exist yet, so the D-Bus API was only used directly, instead of as a backend for other APIs; as a result, focusing the app was more likely than not to put the source of the event that the user was notified about into view Nowadays both persistent notifications and web notifications are wide-spread, so the original reasons no longer apply. This change helps web notifications in particular, as it reduces the differences between XDG and portal-based implementations. Part-of: --- diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js index 769c12245..b2e325f72 100644 --- a/js/ui/notificationDaemon.js +++ b/js/ui/notificationDaemon.js @@ -34,11 +34,6 @@ var FdoNotificationDaemon = class FdoNotificationDaemon { this._notifications = {}; this._nextNotificationId = 1; - - Shell.WindowTracker.get_default().connect('notify::focus-app', - this._onFocusAppChanged.bind(this)); - Main.overview.connect('hidden', - this._onFocusAppChanged.bind(this)); } _imageForNotificationData(hints) { @@ -326,20 +321,6 @@ var FdoNotificationDaemon = class FdoNotificationDaemon { ]; } - _onFocusAppChanged() { - let tracker = Shell.WindowTracker.get_default(); - if (!tracker.focus_app) - return; - - for (let i = 0; i < this._sources.length; i++) { - let source = this._sources[i]; - if (source.app == tracker.focus_app) { - source.destroyNonResidentNotifications(); - return; - } - } - } - _emitNotificationClosed(id, reason) { this._dbusImpl.emit_signal('NotificationClosed', GLib.Variant.new('(uu)', [id, reason]));